package com.fmi.chesstern;

import java.util.HashMap;
import java.util.Map;

import com.fmi.chesstern.gameboard.GameBoard;
import com.fmi.chesstern.gameboard.GameField;
import com.fmi.chesstern.pieces.ChessPiece;

public class Memento {

	private GameBoard board;
	
	private GameField[][] fields;
	private Map<String, ChessPiece> pieces;
	
	public Memento(GameBoard board) {
		this.board = board;
		this.fields = board.getFields();
		this.pieces = new HashMap<String, ChessPiece>(board.getPieces());
	}
	
	public void restore() {
		board.setFields(fields);
		board.setPieces(pieces);
	}
}
